<%--
  Created by IntelliJ IDEA.
  User: zmjha
  Date: 2020/6/17
  Time: 17:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<html>
<head>
    <title>修改信息页面</title>
</head>
<body>
<div id="messsage"></div>
<input id="uid" type="text" value="${userInfo.uid}" style="display: none">
姓名:<input id="rname" type="text" value="${userInfo.rname}">
性别:<input id="sex" type="text" value="${userInfo.sex}">
电话:<input id="phone" type="text" value="${userInfo.phone}">
<button type="button" onclick="sumbit()">提交</button>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">

    function sumbit() {
        var uid=$("#uid").val();
        var rname=$("#rname").val();
        var sex=$("#sex").val();
        var phone=$("#phone").val();

        $.ajax({
            url:"setInfo",
            type:"post",
            data:{"uid":uid,"rname":rname,"sex":sex,"phone":phone},
            success:function (obj) {
                var data=JSON.parse(obj);
                if (data.code==1){
                    alert(data.mes)
                    location.href="getInfo";
                }else {
                    $("#messsage").text(data.mes)
                    location.href="getInfo"
                }
            }
        })

    }
</script>
</html>
